import React from 'react'
import { connect } from 'dva'
import { Form ,Modal,message,Upload,Button} from 'antd'
import { Link, hashHistory } from 'dva/router'
import config from 'config/config'
import $ from 'jquery'
import FlagBtn from 'widget/FlagBtn/FlagView'
import { mapStateToProps } from 'utils/view_utils'
import styles from './basicConfigIndexStyle.less'
// import ListPage from 'widget/PageTmpl/ListPage'
import classnames from 'classnames/bind';
let cx=classnames.bind(styles);
const confirm = Modal.confirm;
let subElements =  JSON.parse(localStorage.navBar).subElements

const newsBulletinView = function({dispatch, model, form}) {
  // 表单的子函数
  // const {resetFields, getFieldDecorator, validateFields, setFieldsValue} = form
  // 取出model对象，命名空间
  const { modelObj, namespace } = model
  // modelObj.xxx获取model中状态机的值
  let {biz,id} = modelObj

   // 查看及编辑跳转
  function goTypeList(type){
    if(type == '集团表单'){
        hashHistory.push({
          pathname: '/home/predictManage/collectiveList',
          query: {}
        })
    }else if(type == '区域表单'){
      hashHistory.push({
        pathname: '/home/predictManage/areaList',
        query: {}
      })
    }else if(type == '项目表单'){
      hashHistory.push({
        pathname: '/home/predictManage/projectList',
        query: {}
      })
    }else if(type == '前策产品类型'){
      hashHistory.push({
        pathname: '/home/predictManage/predictList',
        query: {}
      })
    }else if(type == '城市设置'){
      hashHistory.push({
        pathname: '/home/predictManage/countySet',
        query: {}
      })
    }else{}
  }

  return (
    <div className={cx('li-contenter')}>
      {subElements.includes(170601)&&<div style={{marginRight: '120px'}}>
        <div className={cx('title')}>表单配置</div>
        <ul>
          <li onClick={() => goTypeList('集团表单')}>集团表单</li>
          {/* <li onClick={() => goTypeList('区域表单')}>区域表单</li>
          <li onClick={() => goTypeList('项目表单')}>项目表单</li> */}
        </ul>
      </div>}
      {subElements.includes(170602)&&<div style={{marginRight: '120px'}}>
        <div className={cx('title')}>产品类型配置</div>
        <ul>
          <li onClick={() => goTypeList('前策产品类型')}>前策产品类型</li>
        </ul>
      </div>}
      {subElements.includes(170603)&&<div>
        <div className={cx('title')}>城市配置</div>
        <ul>
          <li onClick={() => goTypeList('城市设置')}>城市设置</li>
        </ul>
      </div>}
    </div>
  )
}
// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(newsBulletinView))
